<div class="weadmin-body">
    <form class="layui-form" data-form='{:request()->url()}'>
        
        <div class="layui-form-item">
            <label for="cid" class="layui-form-label">
                <span class="we-red">*</span>所属分类
            </label>
            <div class="layui-input-inline">
                <select name='cid' id="cid" type="select">
                    <option value="0">未指定分类</option>
                    {foreach $cates as $cate}
                    <option value="{$cate['id']}" {if isset($vo.cid) and ($vo.cid===$cate['id'])}selected{/if} >{$cate['title']}</option>
                    {/foreach}
                </select>
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="we-red">*</span>所属分类
            </div>
        </div>

        <div class="layui-form-item">
            <label for="title" class="layui-form-label">
                <span class="we-red">*</span>名称
            </label>
            <div class="layui-input-inline">
                <input type="text" id="title" name="title" required="" lay-verify="required"
                       value="{$vo.title|default=''}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="we-red">*</span>名称
            </div>
        </div>

        <div class="layui-form-item">
            <label for="url" class="layui-form-label">
                <span class="we-red"></span>链接
            </label>
            <div class="layui-input-inline">
                <input type="text" id="url" name="url" value="{$vo.url|default=''}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="we-red"></span>链接
            </div>
        </div>

        <div class="layui-form-item">
            <label for="description" class="layui-form-label">
                <span class="we-red">*</span>描述
            </label>
            <div class="layui-input-inline">
                <input type="text" id="description" name="description" required="" lay-verify="required"
                       value="{$vo.description|default=''}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <span class="we-red">*</span>描述
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="we-red">*</span>缩略图
            </label>
            <div class="layui-input-inline">
                <button type="button" data-upload="{:url('admin/upload/file')}" data-field="image" data-type="images"
                        value="{$vo.image|default=''}" class="layui-btn">上传文件</button>
                <input type="hidden" name="image"
                       value="{$vo.image|default=''}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                <img data-preview="image" src="{$vo.image|default=''}">
                点击图片删除
            </div>
        </div>

        <div class="layui-form-item layui-col-xs10 layui-col-xs-offset2">
            {if isset($vo.id)}<input type="hidden" name="id" value="{$vo.id}">{/if}
            <button class="layui-btn" lay-submit="">确定</button>
        </div>
    </form>
</div>

<script>
    layui.use('form',function () {
        layui.form.render();
    })
</script>